/*
 * @Description: 
 * @Author: HKH
 * @Date: 2024-09-30 08:36:20
 * @LastEditors: HKH
 * @LastEditTime: 2024-09-30 10:28:37
 */
/*
 * @Description: 
 * @Author: HKH
 * @Date: 2024-09-30 08:36:20
 * @LastEditors: HKH
 * @LastEditTime: 2024-09-30 10:00:17
 */
import java.util.Map;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.Map.Entry;

public class Map1 {
    public static void main(String[] args) {
        Map<Integer,String> map =new HashMap<>();
        map.put(null, null);
        map.put(1,"zl");
        map.put(2,"zle");
        map.put(3,"zsu");
        map.put(1,"zl");
        map.put(4,"z2l");
        System.out.println(map);
        System.out.println(map.size());
        System.out.println(map.containsKey(1));//true
        System.out.println(map.containsKey(6));//false
        System.out.println(map.containsValue("zl"));//true
        String name=map.get(6);
        System.out.println(name);
        map.remove(1);
        System.out.println(map);
        //map.clear();//清除
        //遍历
        // Set<Integer>set=map.keySet();
        // System.out.println(set);
        // for (Integer integer : set) {
        //     //System.out.println(integer);
        //   String name1=  map.get(integer);
        //   System.out.println("id:"+integer+",name:"+name1);
        // }
        Set<Entry <Integer,String>> entrySet=new HashSet<>();
        for (Entry<Integer,String> entry : entrySet) {
            System.out.println(entry);
            Integer key =entry.getKey();
            String value=entry.getValue();
            System.out.println("id:"+key+",name:"+value);
            
        }
    } 
}